import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wallet_utils/button_style.dart';
import 'package:wallet_utils/text_style.dart';
import 'color.dart';

Widget safeBottomContainer({Widget? child, bool hasShadow = false,Color? color}) {
  return Container(
    child: SafeArea(child: child ?? Container()),
    decoration: hasShadow
        ? BoxDecoration(
            color: color ?? ColorManager.colorF4F5F6,
            boxShadow: [
              BoxShadow(
                color: ColorManager.color000000.withOpacity(0.11),
                offset: const Offset(0, 0.0),
                blurRadius: 4.0,
                spreadRadius: 0.0,
              )
            ],
          )
        :  BoxDecoration(color: color ?? ColorManager.colorF4F5F6),
  );
}

Widget setBottomButton(BuildContext context, String title,
    {TextStyle? tvStyle,
    GestureTapCallback? onPressed,
    bool hasShadow = true,
      Color? color,
    ButtonStyle? btStyle}) {
  return safeBottomContainer(
    hasShadow: hasShadow,
    color: color,
    child: Container(
      padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.w),
      width: double.infinity,
      height: 60.w,
      child: ElevatedButton(
        style: btStyle ?? ButtonStyleUtils.buttonStyleF65247(),
        child: Text(title, style: tvStyle ?? TextStyleUtils.styleFFFFFF()),
        onPressed: onPressed,
      ),
    ),
  );
}
Widget setHXHBottomButton(BuildContext context, String title,
    {TextStyle? tvStyle,
      GestureTapCallback? onPressed,
      bool hasShadow = true,
      Color? color,
      ButtonStyle? btStyle}) {
  return safeBottomContainer(
    hasShadow: hasShadow,
    color: color,
    child: Container(
      padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.w),
      width: double.infinity,
      height: 60.w,
      child: ElevatedButton(
        style: btStyle ?? ButtonStyleUtils.buttonStyleHXH(),
        child: Text(title, style: tvStyle ?? TextStyleUtils.styleFFFFFF()),
        onPressed: onPressed,
      ),
    ),
  );
}
Widget setIconBottom(BuildContext context,Widget showWidget,
    {
      GestureTapCallback? onPressed,
      bool hasShadow = true,
      ButtonStyle? btStyle}) {
  return safeBottomContainer(
    hasShadow: hasShadow,
    child: Container(
      padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.w),
      width: double.infinity,
      height: 60.w,
      child: ElevatedButton(
        style: btStyle ?? ButtonStyleUtils.buttonStyleF65247(),
        child: showWidget,
        onPressed: onPressed,
      ),
    ),
  );
}
